#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/12/22 10:00
# @Author: 余桂林
# @Email: 1151026784@qq.com
# @File：__init__.py.py

from selenium.webdriver.common.by import By


class MyPages:
    def __init__(self,driver):
        self.driver = driver

    my_locator = (By.XPATH, '//android.widget.FrameLayout/android.widget.RelativeLayout[1]/android.widget.ImageView[1]')
    left_corner_locator = (By.XPATH, '//android.widget.ImageView[@resource-id=\"com.gfeng.daydaycook:id/menuIv\"]')
    setting_locator = (By.XPATH,'//android.widget.TextView[@text=\"设置\"]')
    personal_data_locator = (By.XPATH, '//android.widget.TextView[@text=\"个人资料\"]')
    username_locator = (By.XPATH, '//android.widget.EditText[@resource-id=\"com.gfeng.daydaycook:id/edt_nickname\"]')
    boy_locator = (By.XPATH, '//android.widget.RadioButton[@resource-id=\"com.gfeng.daydaycook:id/rbt_boy\"]')
    self_introduction_locator = (By.XPATH, '//android.widget.EditText[@resource-id=\"com.gfeng.daydaycook:id/edt_intro\"]')
    btn_locator = (By.XPATH, '//android.widget.TextView[@resource-id=\"com.gfeng.daydaycook:id/rightButton\"]')

    def click_btn_my(self):
        self.driver.find_element(*self.my_locator).click()

    def click_btn_left(self):
        self.driver.find_element(*self.left_corner_locator).click()

    def click_btn_setting(self):
        self.driver.find_element(*self.setting_locator).click()

    def click_btn_personal(self):
        self.driver.find_element(*self.personal_data_locator).click()

    def input_username(self,username):
        self.driver.find_element(*self.username_locator).send_keys(username)

    def click_btn_sex(self):
        self.driver.find_element(*self.boy_locator).click()

    def input_self_introduction(self,self_introductio):
        self.driver.find_element(*self.self_introduction_locator).send_keys(self_introductio)

    def click_btn_save(self):
        self.driver.find_element(*self.btn_locator).click()